<div class="loader"></div>
<h3>{{ $title }} ID#{{ $result->id }}</h3>

<table class="table table-bordered table-striped table-hover">
	<tr>
    	<td class="text-left">{{ $form_sales_order_id }}</td>
		<td class="text-right">{{ $result->ORDER_id }}</td>
	</tr>
	<tr>
    	<td class="text-left">{{ $form_details_amount }}</td>
		<td class="text-right">{{ number_format($result->orderInformation->topup, 2) }}</td>
	</tr>
	<tr>
    	<td class="text-left">{{ $form_products }}</td>
		<td class="text-left">
		<ul>
		@foreach($result->orderInformation->orderProducts as $order_product)
		<li>{{ $order_product->name }}</li>
		@endforeach
		</ul>
		</td>
	</tr>	
</table>
{{ Form::model($result, array('route' => array($base . '.update', $result->id), 'method' => 'PUT', 'id' => 'form')) }}

	<div class="bs-example">
	<h3>{{ $text_details }}</h3>
	    <ul class="nav nav-tabs">
	    	@foreach($result->topupInformation as $index=>$reference)
	        <li @if(!$index) class="active" @endif><a data-toggle="tab" href="#Section{{ $index }}">Reference {{ $index + 1 }}</a></li>
	        @endforeach
	    </ul>
	   
	    <div class="tab-content">
	     @foreach($result->topupInformation as $index=>$reference)
	        <div id="Section{{ $index }}" class="tab-pane fade in @if(!$index) active @endif ">
	            <div class="form-group">
	            @if($result->payment_method == Constant::PAYMENT_BANK_DEPOSIT )
					{{ ($reference->image != null) ? HTML::image(Asset::cdn($reference->image),null,array('class'=>'form-control','style'=>'500px; height: 300px; overflow: hidden;')) : HTML::image('http://goodology.com/wp-content/themes/TechNews/images/img_not_available.png', null) }}
				@endif
	        </div>
				<div class="form-group">
					{{ Form::label('reference_number', $form_ref_number) }}
					<!--{{ Form::text('topup_information[' . $index . '][reference_number]', $reference->reference_number, array('id'=>'reference_number','class' => 'form-control' ) ) }} -->
					<input id="reference_number" class="form-control" name="topup_information[{{ $index }}][reference_number]" 
						type="text" value="{{ $reference->reference_number }}" @if($result->payment_method != Constant::PAYMENT_BANK_DEPOSIT )disabled="disabled"  @endif></input>
					<span class="error text-danger" id="error_topup_information_{{ $index }}_reference_number"></span>
				</div>
					<div class="form-group">
					{{ Form::label('amount', $form_amount) }}
					<!--{{ Form::text('topup_information[' . $index . '][amount]', $reference->amount, array('id'=>'amount','class' => 'form-control')) }}  -->
					<input id="amount" class="form-control" name="topup_information[{{ $index }}][amount]" 
						type="text" value="{{ $reference->amount }}" @if($result->payment_method != Constant::PAYMENT_BANK_DEPOSIT )disabled="disabled"  @endif></input>
					<span class="error text-danger" id="error_topup_information_{{ $index }}_amount"></span>
				</div>
					<div class="form-group">
					{{ Form::label('date', $form_deposit_time) }}
					<!-- {{ Form::text('topup_information[' . $index . '][date]', $reference->date, array('id'=>'date','class' => 'form-control datepick')) }} -->
					<input id="date" class="form-control datepick" name="topup_information[{{ $index }}][date]"  
					type="text" value="{{ $reference->date }}" @if($result->payment_method != Constant::PAYMENT_BANK_DEPOSIT )disabled="disabled"  @endif></input>
					<span class="error text-danger" id="error_topup_information_{{ $index }}_date"></span>
				</div>
				
				<div class="form-group">
					{{ Form::label('image', $form_image) }}
					<div>
					{{ ($reference->image != null) ? HTML::image(Asset::cdn('img/topup/' . $reference->image), null, ['style' => 'width:100%']) : HTML::image('http://goodology.com/wp-content/themes/TechNews/images/img_not_available.png', null) }}
					</div>
				</div>
				
				<div class="form-group">
					{{ Form::hidden('topup_information[' . $index . '][id]', $reference->id, array('id'=>'topup_info_id','class' => 'form-control')) }}
				</div>
	        </div>
	       @endforeach
	    </div>
	    	
	</div>
	 <div class="form-group">
		{{ Form::label('topup_action', 'Move to') }}{{-- Added Field --}}
		{{ Form::select('topup_action', Lang::get('topup.topup_action'), Input::get('topup_action'),  array('class' => 'form-control') ) }}
	</div>
	<div class="form-group">
		{{ Form::label('comment', $form_comment) }}
		{{ Form::text('comment', null, array('id'=>'comment','class' => 'form-control')) }}
		<span class="error text-danger" id="error_comment"></span>
	</div>
	{{ Form::submit($text_submit, array('class' => 'btn btn-primary', 'id' => 'submit', 'data-loading-text' => $text_loading)) }}
	{{ HTML::link( URL::to($base . '/'), $text_cancel, array('class' => 'btn btn-default', 'id'=> 'cancel')) }}
		
{{ Form::close() }}

<?php 
/*foreach($data['topup_information'] as $index=>$reference) {
	echo $reference['image']
	'topup_information[' . $index . '][image]' - naming
}*/
?>

<script type="text/javascript">
$(function () {
	$('.datepick').datetimepicker({
		format: 'YYYY-MM-DD hh:mm:ss',
		sideBySide: true,
		});
});
</script>